import type {
  TextComponentProps,
  ImageComponentProps,
  IPageProps,
} from '@/defaultProps'
import { v4 } from 'uuid'
export interface EditorProps {
  components: ComponentData[]
  currentElement: string
}

export interface ComponentData {
  props: {
    [key: string]: unknown
  }
  id: string
  name: string
  isHidden?: boolean // 是否隐藏
  isLocked?: boolean // 是否锁定
  layerName?: string // 图层名称
  zIndex?: number // 图层顺序
}

export interface LayerListProps {
  props: Partial<TextComponentProps & ImageComponentProps> // 组件属性
  id: string // 组件id
  name: 'l-text' | 'l-image' | 'l-shape' // 组件名称
  isHidden?: boolean // 是否隐藏
  isLocked?: boolean // 是否锁定
  layerName?: string // 图层名称
}
export interface ISaveTemplateProps {
  title: string
  desc: string
  coverImg: string
  content: {
    components: ComponentData[]
    props: Partial<IPageProps>
  }
}

export interface IHistoryProps {
  id: string
  componentId: string
  type: 'add' | 'delete' | 'update'
  data: any
  index?: number
}
